/**
 * This class write the circuit in serialization.
 * 
 * @author Gregory Banfi (gregory.banfi@usi.ch);
 * @version 24.05.2011
 */

package ch.usi.inf.pf2;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;


public class WriteCircuit {
	
	private ArrayList<Component> components; 
	
	public WriteCircuit(ArrayList<Component> components, String fileName) {
		this.components = components;
		String path = fileName+".ser";
		FileOutputStream fos = null;
		ObjectOutputStream out = null;
		try {
			fos = new FileOutputStream(path);
			out = new ObjectOutputStream(fos);
			out.writeObject(components);
			out.close();
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}
}
